home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / qex / qexsndcd / cw250.dsp < prev    next >
Text File  |  1994-06-10  |  6KB  |  202 lines

  1. {---------------------------------------------------------------------------}
  2. {                PSA super duper 250 Hz CW filter                        }
  3. {      Demo software accompanying the QEX xxx   1994 article:            }
  4. {      "Using a Programmable PC Sound Card for Amateur Radio"               }
  5. {                  (c) Johan Forrer, KC7WW                    }
  6. {             26553 Priceview Drive                                  }
  7. {                    Monroe, OR 97456                        }
  8. {---------------------------------------------------------------------------}
  9. {                                        }
  10. {               Assembly instructions:                                      }  
  11. {        ----------------------                        }
  12. {                 >spasm21 cw250.dsp                                      }
  13. {                                        }
  14. { ------------------------------------------------------------------------- }
  15.  
  16. {   DSP hardware addresses used by user's application                       }
  17. .const dmal_1848    =0x3060;
  18. .const dmar_1848    =0x3068;
  19.  
  20. { Note: delay lines use circular addressing                                 }
  21. {         9- 16 requires a " 16=0x0010" boundary                            }
  22. { length 17- 32 requires a " 32=0x0020" boundary                            }
  23. {        33- 64 requires a " 64=0x0040" boundary                            }
  24. {        65-128 requires a "128=0x0080" boundary                            }
  25. {       129-256 requires a "256=0x0100" boundary                            }
  26.  
  27. { Define space for the FIR bandpass filter delay line                }
  28. .const BPFI        =0x3800;    { 3800 ->  Input bandpass         }
  29.  
  30. .const bpf_out        =0x3900;    { Ouput of FIR filter               }
  31. {---------------------------------------------------------------------------}
  32. { This is the user's DSP application code. It's part of the AD1848 ISR      }
  33. { It should be kept as efficient as possible.                               }
  34. {---------------------------------------------------------------------------}
  35. 0x0100  sound_prt:
  36.     ena sec_reg;            { use alternate registers }
  37.     
  38. { The way we have the audio jack connected, only the left line              }
  39. { channel will carry a signal.                             }
  40. { Input data is saved in a circular buffer.                                 }
  41.  
  42.     ar=dm(bpf_out);            { pick up oldest value }
  43.     dm(dmal_1848)=ar;
  44.     dm(dmar_1848)=ar;        { this also resets interrupt }
  45.  
  46.     ar=dm(dmal_1848);        { using only left input channel }
  47.     dm(i1,m1)=ar;
  48.     ar=dm(dmar_1848);        { read right input but discard it }
  49.  
  50.     call bandpass;            { call bandpass routine }
  51.  
  52.     dis sec_reg;            { use normal registers }
  53.     rti;
  54.  
  55. {--FIR FILTER---------------------------------------------------------------}
  56. {                                         }
  57. { This FIR filter was designed using the window method. The window used     }
  58. { was a KAISER-BESSEL type, filter length is 127 taps.                      }                            
  59. { Sampling frequency is          5512.500 Hz                    }
  60. { Lower cut-off frequency is      375.000 Hz                    }
  61. { Upper cut-off frequency is      525.000 Hz                    }
  62. { -------------------------Filter coefficients----------------------------- }
  63. dc:    0xFFFD00; {    -3}
  64.     0xFFF900; {    -7}
  65.     0xFFF700; {    -9}
  66.     0xFFF600; {   -10}
  67.     0xFFFA00; {    -6}
  68.     0x000200; {     2}
  69.     0x000D00; {    13}
  70.     0x001800; {    24}
  71.     0x001F00; {    31}
  72.     0x001E00; {    30}
  73.     0x001300; {    19}
  74.     0xFFFF00; {    -1}
  75.     0xFFE600; {   -26}
  76.     0xFFD100; {   -47}
  77.     0xFFC600; {   -58}
  78.     0xFFCA00; {   -54}
  79.     0xFFDF00; {   -33}
  80.     0xFFFE00; {    -2}
  81.     0x001F00; {    31}
  82.     0x003700; {    55}
  83.     0x004000; {    64}
  84.     0x003600; {    54}
  85.     0x001F00; {    31}
  86.     0x000400; {     4}
  87.     0xFFF200; {   -14}
  88.     0xFFEF00; {   -17}
  89.     0xFFFB00; {    -5}
  90.     0x000E00; {    14}
  91.     0x001800; {    24}
  92.     0x000A00; {    10}
  93.     0xFFE000; {   -32}
  94.     0xFF9F00; {   -97}
  95.     0xFF5F00; {  -161}
  96.     0xFF3D00; {  -195}
  97.     0xFF5800; {  -168}
  98.     0xFFBE00; {   -66}
  99.     0x006400; {   100}
  100.     0x012300; {   291}
  101.     0x01C000; {   448}
  102.     0x01FB00; {   507}
  103.     0x01A700; {   423}
  104.     0x00BA00; {   186}
  105.     0xFF5F00; {  -161}      
  106.     0xFDEB00; {  -533}      
  107.     0xFCCC00; {  -820}      
  108.     0xFC6900; {  -919}      
  109.     0xFD0000; {  -768}      
  110.     0xFE8B00; {  -373}      
  111.     0x00B800; {   184}
  112.     0x02F900; {   761}
  113.     0x04AA00; {  1194}
  114.     0x053E00; {  1342}
  115.     0x046F00; {  1135}
  116.     0x025500; {   597}
  117.     0xFF6D00; {  -147}
  118.     0xFC7800; {  -904}
  119.     0xFA4700; { -1465}
  120.     0xF98100; { -1663}
  121.     0xFA6E00; { -1426}
  122.     0xFCDF00; {  -801}
  123.     0x003800; {    56}
  124.     0x039600; {   918}
  125.     0x060F00; {  1551}
  126.     0x06F700; {  1783}
  127.     0x060F00; {  1551}
  128.     0x039600; {   918}
  129.     0x003800; {    56}
  130.     0xFCDF00; {  -801}
  131.     0xFA6E00; { -1426}
  132.     0xF98100; { -1663}
  133.     0xFA4700; { -1465}
  134.     0xFC7800; {  -904}
  135.     0xFF6D00; {  -147}
  136.     0x025500; {   597}
  137.     0x046F00; {  1135}
  138.     0x053E00; {  1342}
  139.     0x04AA00; {  1194}
  140.     0x02F900; {   761}
  141.     0x00B800; {   184}
  142.     0xFE8B00; {  -373}
  143.     0xFD0000; {  -768}
  144.     0xFC6900; {  -919}
  145.     0xFCCC00; {  -820}
  146.     0xFDEB00; {  -533}
  147.     0xFF5F00; {  -161}
  148.     0x00BA00; {   186}
  149.     0x01A700; {   423}
  150.     0x01FB00; {   507}
  151.     0x01C000; {   448}
  152.     0x012300; {   291}
  153.     0x006400; {   100}
  154.     0xFFBE00; {   -66}
  155.     0xFF5800; {  -168}
  156.     0xFF3D00; {  -195}
  157.         0xFF5F00; {  -161}
  158.     0xFF9F00; {   -97}
  159.     0xFFE000; {   -32}
  160.     0x000A00; {    10}
  161.     0x001800; {    24}
  162.     0x000E00; {    14}
  163.     0xFFFB00; {    -5}
  164.     0xFFEF00; {   -17}
  165.     0xFFF200; {   -14}
  166.     0x000400; {     4}
  167.     0x001F00; {    31}
  168.     0x003600; {    54}
  169.     0x004000; {    64}
  170.     0x003700; {    55}
  171.     0x001F00; {    31}
  172.     0xFFFE00; {    -2}
  173.     0xFFDF00; {   -33}
  174.     0xFFCA00; {   -54}
  175.     0xFFC600; {   -58}
  176.     0xFFD100; {   -47}
  177.     0xFFE600; {   -26}
  178.     0xFFFF00; {    -1}
  179.     0x001300; {    19}
  180.     0x001E00; {    30}
  181.     0x001F00; {    31}
  182.     0x001800; {    24}
  183.     0x000D00; {    13}
  184.     0x000200; {     2}
  185.     0xFFFA00; {    -6}
  186.     0xFFF600; {   -10}
  187.     0xFFF700; {    -9}
  188.     0xFFF900; {    -7}
  189.     0xFFFD00; {    -3}
  190. { --------------------------------------------------------------------------}
  191. bandpass:      
  192.     i4=dc;                { point to coefficients }
  193.     mr=0, mx0=dm(i1,m1), my0=pm(i4,m5);
  194.     cntr=126;            { length - 1 }
  195.     do sopbp until ce;
  196. sopbp:    mr=mr+mx0*my0(ss), mx0=dm(i1,m1), my0=pm(i4,m5);
  197.     mr=mr+mx0*my0(rnd);
  198.     if mv sat mr;
  199.     dm(bpf_out)=mr1;
  200.     rts;
  201. { --------------END OF USER APPLICATION-------------------------------------}
  202.